import common from './common';
import XEUtils from "xe-utils";
import VXETable from "vxe-table";
// 创建一个下拉表格渲染
VXETable.renderer.add("vDownDialog", {
    autofocus: ".vxe-input--inner",
    renderEdit(h, renderOpts, params) {
        // eslint-disable-next-line no-unused-lets
        const { row, column } = params;
        const { attrs, props, filter } = renderOpts;
        let cellValue = XEUtils.get(row, column.property);
        let check = typeof filter === 'undefined' || (typeof filter === 'function' && filter(row, column));
        if (!check) {
            return [h('span', { class: 'vxe-cell--label' }, cellValue)];
        }
        return [
            // <v-down-dialog params={ params } props={props} attrs={attrs}></v-down-dialog>
            h("v-down-dialog", {
                attrs: attrs,
                props: Object.assign(props, { params, value: cellValue }),
                on: common.getEditOns(renderOpts, params),
                nativeOn: common.getNativeOns(renderOpts, params)
            })
        ];
    }
});
